package au.edu.swin.MelbourneMap;

import java.util.*;
import java.awt.geom.*;

/**
 * Data structure to define a road comprised of Path2D of points. 
 *
 * @author  Alexis Wellavize (s/n: 6033482)<br/>
 *           Dotan Tamir (s/n: 6532969)
 * @since   v1, created:  25/09/2012
 * @version v1, modified:  25/09/2012
 *
 */
 
class Road
{
    /// Name of road
    private String roadName;
    // Has road been clicked?
    private Boolean isSelected;
    /// Path2D for road
    private ArrayList<Path2D> road;
    /// x,y coordinates
    private Double x, y;
    /// easting and northing coordinates
    private Double e1, e2, n1, n2;
    /// Minimum and maximum easting values
    private Double minE, maxE;
    /// Minimum and maximum northing values
    private Double minN, maxN;
    /// Region Visibility
    private boolean visibility;
        
    // Overloaded constructor
    public Road( String roadName )
    {
    	this.roadName = roadName;
        this.road = new ArrayList<Path2D>();
        this.isSelected = false;
    }
    
    // Accessor methods
    public String getName()
    {
    	return roadName;
    }
    
    public ArrayList<Path2D> getRoad()
    {
        return road;
    }
    
    public Double getMinE()
    {
        return minE;
    }
    
    public Double getMaxE()
    {
        return maxE;
    }
    
    public Double getMinN()
    {
        return minN;
    }
    
    public Double getMaxN()
    {
        return maxN;
    }
    
    public boolean getVisibility()
    {
        return visibility;
    }
    
    // Mutator methods
    public void setName( String roadName )
    {
    	this.roadName = roadName;
    }
    
    public void setRoad( ArrayList<Path2D> road )
    {
    	this.road = road;
    } 
    
    public void setMinE( Double minE )
    {
    	this.minE = minE;
    }
    
    public void setMaxE( Double maxE )
    {
    	this.maxE = maxE;
    }
    
    public void setMinN( Double minN )
    {
    	this.minN = minN;
    }

    public void setMaxN( Double maxN )
    {
    	this.maxN = maxN;
    }
    
    public void setVisibility( boolean visibility )
    {
        this.visibility = visibility;
    }
    
    /**
     *
     * Reads Australian Map Grid data for region.
     * Stops when line "end" is read.
     * @param input open file which has just read the number
     *
     */
    public void read( Point2D start, Point2D end )
    {
        Path2D path = new Path2D.Double();
        path.moveTo( start.getX(), start.getY() );
        path.lineTo( end.getX(), end.getY() );  
        road.add( path );
    }

	public void setIsSelected(Boolean isSelected) {
		this.isSelected = isSelected;
	}

	public Boolean getIsSelected() {
		return isSelected;
	}
}